.TH std::experimental::filesystem::path::remove_filename 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::experimental::filesystem::path::remove_filename \- std::experimental::filesystem::path::remove_filename

.SH Synopsis
   path& remove_filename() \fB(1)\fP (filesystem TS)

   Removes a single filename component.

   The behavior is undefined if the path has no filename component (has_filename
   returns false).

.SH Parameters

   \fI(none)\fP

.SH Return value

   *this

.SH Exceptions

   May throw implementation-defined exceptions.

.SH Example


// Run this code

 #include <experimental/filesystem>
 #include <iostream>
 namespace fs = std::experimental::filesystem;

 int main()
 {
     std::cout << fs::path("/foo").remove_filename() << '\\n'
               << fs::path("/").remove_filename() << '\\n';
 }

.SH Output:

 "/"
 ""

.SH See also

   filename         returns the filename path component
                    \fI(public member function)\fP
   replace_filename replaces the last path component with another path
                    \fI(public member function)\fP
   has_filename     checks if the corresponding path element is not empty
                    \fI(public member function)\fP

.SH Category:
     * Noindexed pages
